//
//  MessageDetailEntity.m
//  QQplayground
//
//  Created by zhangxy on 2018/8/16.
//  Copyright © 2018年 zhang. All rights reserved.
//

#import "MessageDetailEntity.h"

@implementation MessageDetailEntity

- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [super init];
    if (self) {
        self = [MessageDetailEntity yy_modelWithDictionary:dictionary];
        _user_info = [[User alloc] initWithDictionary:dictionary[@"user_info"]];
        
        if(dictionary[@"mapping"][@"mapping_info"]){
            _mapping_info =[[MessageMappingEntity alloc] initWithDictionary:dictionary[@"mapping"][@"mapping_info"]];
        }
        
        if(dictionary[@"mapping"][@"mapping_parent_info"]){
            _mapping_parent_info =[[MessageMappingEntity alloc] initWithDictionary:dictionary[@"mapping"][@"mapping_parent_info"]];
        }
        if(dictionary[@"mapping"][@"mapping_root_info"]){
            _mapping_root_info =[[MessageMappingEntity alloc] initWithDictionary:dictionary[@"mapping"][@"mapping_root_info"]];
        }
    }
    return self;
}


+ (NSDictionary<NSString *,id> *)modelCustomPropertyMapper
{
    return @{
             @"feed_id" : @"feed_id",
             @"m_id" : @"id",
             @"type":@"type",
             @"content":@"content",
             @"mapping_read":@"mapping_read",
             @"add_time":@"add_time"
             };
}

@end


@implementation MessageMappingEntity

- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [super init];
    if (self) {
        self = [MessageMappingEntity yy_modelWithDictionary:dictionary];
        if(dictionary[@"image"]){
            _image = [[ImageEntity alloc] initWithDictionary:dictionary[@"image"]];
        }
    }
    return self;
}


+ (NSDictionary<NSString *,id> *)modelCustomPropertyMapper
{
    return @{
             @"mapping_id" : @"id",
             @"type" : @"type",
             @"cat_id":@"cat_id",
             @"message":@"message",
             @"message_arr_1":@"message_arr_1",
             @"message_arr_2":@"message_arr_2"
             };
}

@end
